package command.concreteCommand;

import command.Command;
import receiver.AirConditioner;

// 具体命令 - 空调开关命令
public class AirConditionerCommand implements Command {
    private AirConditioner airConditioner;
    private int prevTemperature;
    
    public AirConditionerCommand(AirConditioner airConditioner) {
        this.airConditioner = airConditioner;
    }
    
    @Override
    public void execute() {
        prevTemperature = airConditioner.getTemperature();
        airConditioner.on();
    }
    
    @Override
    public void undo() {
        airConditioner.setTemperature(prevTemperature);
        airConditioner.off();
    }
}